<Card Class="dashboard-orders-root">
    <CardHeader
        Title="Latest Orders">
        <ActionContent>
            <Button
                Color="@Color.Primary"
                Size="@Size.Small"
                Variant="@ButtonVariant.Outlined">
                New entry
            </Button>
        </ActionContent>
    </CardHeader>
    <Divider />
    <CardContent Class="dashboard-orders-content">
        <div class="dashboard-orders-inner">
            <Table>
                <TableHead>
                    <TableRow>
                        <TableCell>Order Ref</TableCell>
                        <TableCell>Customer</TableCell>
                        <TableCell Sort="@Sort.Descending">
                            <TableSortLabel
                                Active
                                Direction="@Sort.Descending">
                                Date
                            </TableSortLabel>
                        </TableCell>
                        <TableCell>Status</TableCell>
                    </TableRow>
                </TableHead>
                <TableBody>
                  @foreach(var order in Orders)
                  {
                      <TableRow
                          Hover
                          @key="@order.Id">
                          <TableCell>@order.Ref</TableCell>
                          <TableCell>@order.Customer</TableCell>
                          <TableCell>
                              @order.CreatedAt.ToString("dd/mm/yyyy")
                          </TableCell>
                          <TableCell>
                            <div class="dashboard-orders-status-container">
                                <StatusBullet
                                    Class="dashboard-orders-status"
                                    Color="@(StatusColors[order.Status])"
                                    Size="@StatusSize.Small"
                                />
                                @order.Status
                            </div>
                        </TableCell>
                    </TableRow>
                }
                </TableBody>
            </Table>
        </div>
    </CardContent>
    <Divider />
    <CardActions Class="dashboard-orders-actions">
        <Button
            Color="@Color.Primary"
            Size="@Size.Small"
            Variant="@ButtonVariant.Text">
            View all <ArrowRightIcon />
        </Button>
    </CardActions>
</Card>

@code
{
    [Parameter]
    public IEnumerable<Order> Orders { set; get; }

    private readonly static IDictionary<string, StatusColor> StatusColors = new Dictionary<string, StatusColor>
    {
        { "delivered", StatusColor.Success },
        { "pending", StatusColor.Info },
        { "refunded", StatusColor.Danger }
    };
}